package com.company.http;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

public class HeardInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request originalRequest = chain.request();
        Request.Builder builder = originalRequest.newBuilder();
        //设置具体的header内容
        builder.header("timestamp", System.currentTimeMillis() + "");
        builder.header("user-agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36");
        builder.header("authorization","BasicAuth 04707AC5AADE10D43F338BCE84D09295A829ECADFA3CB1158BB6FEC9077D0D278B0E435E01BB15B3CD1BC4E7BE347314E8AE6C3D057F0343F5AE540CBCDDAF5102601EB96CEB24FB8D7E2781F8FD499BC7FEBC6951B403D833495F451DEF4AFAD7B75B48D825770B47260563E0F25CA98BA39D6ED626EABE61CE1E04BABE4EDD84C4F5C99A456F1D4850AA8A6E72AD90F96E47A950CC9E953FC6DB17AD7FC20A299D344331146E50D489DB377300B6821604A8B992AD56439A918598B6717598A105B6FBE1EC6E2C41366BE26C96FDE0D2AEF53C60DB2D62F99063C64C0C0F065F9C868BC17FD1476FF7BDFDF66EDE93C4D5104760026B6DF5C227FD943480018C0506F20646C78CBD07109407F6B464434638D3C067D5F1AB0608D4D4C45ECBA5F18F4A0A78B2CFF8CEC7320276BA5E61F445");
        Request.Builder requestBuilder = builder.method(originalRequest.method(), originalRequest.body());
        Request request = requestBuilder.build();
        return chain.proceed(request);
    }
}
